const { DataTypes } = require('sequelize');
const sequelize = require('../index');
const {WorkSeeker} = require("./work_seekers");

const User = sequelize.define('db_users', {
    id: {
        type: DataTypes.INTEGER,
        primaryKey: true,
        autoIncrement: true
    },
    username: {
        type: DataTypes.STRING,
        allowNull: false,
        unique: true
    },
    password: {
        type: DataTypes.STRING,
        allowNull: false
    },
    email: {
        type: DataTypes.STRING,
        allowNull: true,
        unique: true
    },
    nickname: {
        type: DataTypes.STRING,
        allowNull: true  // 允许为空
    },
    avatar: {
        type: DataTypes.STRING,
        allowNull: true
    },
    work_position: {
        type: DataTypes.STRING,
        allowNull: true
    },
    year: {
        type: DataTypes.DOUBLE,
        allowNull: true
    },
    role: {
        type: DataTypes.INTEGER,
        allowNull: true
    },
    is_working: {
        type: DataTypes.INTEGER,
        allowNull: true
    },
}, {
    timestamps: false
});

module.exports = { User };
